<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link type="text/css" href="/css/start/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />	
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="/js/jquery.leanModal.min.js"></script>
<link href="/css/template.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
	$(function() {
		$( "#date_begin" ).datepicker({ dateFormat: "yy-mm-dd",firstDay: 1 });
		$( "#date_end" ).datepicker({ dateFormat: "yy-mm-dd"});
		
	});

	function changeNo(source){
		var changeValue = $(source).attr('value');
		$("input[id^='multi_no']").attr('value',changeValue);
		
	}
</script>
</head>
<body>
<h1>Repair Bonus for Cycle <?php echo $this->cycle;?></h1>
<h2>( <?php echo $this->dateBegin?> ~ <?php echo $this->dateEnd?> )</h2>
<form method = "post" action = "" enctype="multipart/form-data">
<table border="1" cellspacing="0" cellpadding="5">
<tr>
<th colspan = "4">Pick Perfect Service Rules</th>
<th colspan = "1">Change Multi Number</th>
</tr>
<tr>
	<td><input type = 'checkbox' name = 'rule_policy' id = 'rule_policy'> </input>Policy(Contact&#38;Cust Parts)</td>
	<td><input type = 'checkbox' name = 'rule_fixhq' id = 'rule_fixhq'> </input>Fix By HQ</td>
	<td><input type = 'checkbox' name = 'rule_discount' id = 'rule_discount'></input>Discount</td>
	<td><input type = "submit" name = "submit_rule" id = "submit_rule" value ="Submit Rule"></input></td>
	<td rowspan = "2"><input type = "text" name = "change_multi" id = "change_multi" value ="" onchange = "changeNo(this)"></input></td>
	
</tr>
	
</table>

<br/>
<br/>

<table width="1000" border="1" cellspacing="0" cellpadding="15">
<tr>
	<th>Shop</th>
	<th>Repair Parts(APOS)</th>
	<th>Repair Parts(DATABASE)</th>
	<th>Service Total</th>
	<th ><span style = "color:red;">All Total*</span></th>
	<th>Perfect Parts Total</th>
	<th>Perfect Service Total</th>
	<th>Perfect Total</th>
	<th>Multi No.</th>
</tr>
<?php $shopgroup = unserialize(ARR_SHOP_GROUP);?>
<?php foreach ($this->list as $k => $v){
		$smaller = 0;
		$bigger = 0;
		$key = array_search($k, $shopgroup);?>
<tr>
	<td><?php echo $k;?><input type = "hidden" name = "shop_id[<?php echo $key?>]" id = "shop_id[<?php echo $key?>]" value = "<?php echo $key?>"></input></td>
	<td><?php if($v['parts_apos']){echo $v['parts_apos'];}else{echo 0;}?></td>
	<td><?php if($v['parts_database']){echo $v['parts_database'];}else{echo 0;}?></td>
	<td><?php if($v['service_no']){echo $v['service_no'];}else{echo 0;}?></td>
	<?php if($v['parts_apos'] > $v['parts_database']){
				$smaller = $v['parts_database'];
				$bigger = $v['parts_apos'];
		  }else{
		  		$smaller = $v['parts_apos'];
		  		$bigger = $v['parts_database'];
		  }
			$existTotal = $smaller + $v['service_no'];?>
	<td><span style = "color:red;"><?php echo $existTotal;?></span><input type = "hidden" name = "service_value[<?php echo $key?>]" id = "service_value[<?php echo $key?>]" value = "<?php if($existTotal){echo $existTotal;}else{echo 0;}?>"></input></td>
	<td><?php if($bigger){echo $bigger;}else{echo 0;}?></td>
	<td><?php if($v['perfect_service']){echo $v['perfect_service'];}else{echo 0;}?></td>
	<td><?php echo ($bigger + $v['perfect_service']);?></td>
	<td><input type = "text" name = "multi_no[<?php echo $key?>]" id = "multi_no[<?php echo $key?>]" value = "3.5" class = "multi_no"></input></td>
</tr>


<?php } ?>
</table>
<br/><br/>
<input type = "submit" name = "calculate" id = "calculate" value ="Calculate&Next" style= "margin-left:880px;"></input>
</form>
</body>
</html>
